package com.situ.doman;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.UUID;

public class test0728 {
    public static void main(String[] args) throws IOException {
        String name = UUID.randomUUID().toString();
        System.out.println(name);
        
        FileInputStream fis = null;
        FileOutputStream pos = null;
        String path = "D:\\娱乐\\壁纸";
        String pathOut = "D:\\娱乐\\test";
        // 获得指定文件对象  
        File file = new File(path);   
        // 获得该文件夹内的所有文件   
        File[] array = file.listFiles();
        
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i].toPath());
            fis = new FileInputStream(array[i]);
            pos = new FileOutputStream(pathOut + "\\"+ i +".jpg");
            byte[] temp = new byte[1024];
            int len = 0;
            while ((len = fis.read(temp)) > 0) {
                pos.write(temp, 0, len);
            }
        }
        fis.close();
        pos.close();
        fis = null;
        pos = null;
        

        
//        FileInputStream fis = new FileInputStream(file);
//        FileOutputStream pos = new FileOutputStream(new File("cat2.jpg"));
//        
//        byte[] temp = new byte[1024];
//        
//        while (fis.read(temp) > 0) {
//            pos.write(temp);
//        }
//        
//        fis.close();
//        pos.close();
//        fis = null;
//        pos = null;
//        
    }
}
